home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / util / cli / GetUnique.lha / GetUnique.c next >
Encoding:
Text File  |  1995-03-10  |  1.8 KB  |  82 lines

  1. /*
  2.  
  3.     GetUnique 1.1 (10.3.95) was written by Thomas Esser.
  4.  
  5.     - DISCLAIMER -
  6.  
  7.     GetUnique is Copyright (c) 1995 Thomas Esser, but you may freely
  8.     use it and pass any number of copies to your friends, as long as you
  9.     don't charge anyone for giving him/her a copy.  You are NOT allowed
  10.     to modify the distribution archive which may only be copied complete
  11.     and intact. The archive MUST contain the following files:
  12.  
  13.     GetUnique    - 200  Bytes
  14.     GetUnique.c    - 1810 Bytes
  15.     SCOPTIONS    - 316  Bytes
  16.  
  17.     YOU AGREE TO USE THIS PROGRAM ENTIRELY AT YOUR OWN RISK! I CAN'T BE
  18.     HELD  RESPONSIBLE  FOR  DAMAGE WHATSOEVER RESULTING FROM USING THIS
  19.     PROGRAM!
  20.  
  21.  
  22.     - PURPOSE -
  23.  
  24.     GetUnique must be called from CLI only! It returns a number, which
  25.     will be unique. I use this for generating Filenames who must be
  26.     definitly unique, e.g. in Shell or Rexxscripts. In the shell you
  27.     can use it via the backtick (`) characters:
  28.  
  29.     move foo foo.`getunique`
  30.  
  31.     GetUnique need Kickstart V39 - 3.0 or better.
  32.  
  33.  
  34.     - RECOMPILING -
  35.  
  36.     I use V6.55 of the SAS/C Compiler and the SCOPTIONS File.
  37.  
  38.  
  39.     - THANKS GOES TO -
  40.  
  41.     Ralph 'Zodiac' Seichter, for tips & tricks, sources and many really
  42.     useful programs and last not least - the Backtickstrick :).
  43.  
  44.     SAS, for this great compiler.
  45.  
  46.  
  47.     - CONTACT ME -
  48.  
  49.     Thomas Esser
  50.     T.v. Wuellenweberstr. 28
  51.     D-50169 Kerpen
  52.  
  53.     Phone: (49)2273 910061Q
  54.  
  55.     EMail: t.esser@darness.gun.de
  56.  
  57. */
  58.  
  59. LONG getunique (VOID);
  60.  
  61. const static char __ver[] = "$VER: GetUnique 1.1 " __AMIGADATE__;
  62.  
  63. LONG __saveds getunique (VOID)
  64. {
  65.     struct Library *DOSBase;
  66.     struct Library *UtilityBase;
  67.     LONG rc = RETURN_FAIL;
  68.  
  69.     if (DOSBase = OpenLibrary (DOSNAME, 39))
  70.     {
  71.         {
  72.             UtilityBase=OpenLibrary (UTILITYNAME, 39);
  73.                 Printf("%lu",GetUniqueID());
  74.             CloseLibrary (UtilityBase);
  75.  
  76.             rc = RETURN_OK;
  77.         }
  78.         CloseLibrary (DOSBase);
  79.     }
  80.     return (rc);
  81. }
  82.